package com.manulife.hk.performance.model;


import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;


import javax.validation.constraints.*;

/**
 * SubmitSale
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SubmitSale {

	private Long id;

	@Size(max = 20)
	private String submitSalesKey;

	@Size(max = 2)
	private String submitSalesSubKey;

	@Size(max = 20)
	private String submitSalesCaptureKey;

	@NotNull
	@Size(max = 10)
	private String submitType;

	@NotNull
	private LocalDateTime submitDateTime;


	/**
	 * Gets or Sets lob
	 */
	public enum LobEnum {
		IND("IND"),

		WM("WM"),

		MAM("MAM"),

		GP("GP"),

		GI("GI"),

		GLH("GLH"),

		CRC("CRC");

		private String value;

		LobEnum(String value) {
			this.value = value;
		}

		@Override
		@JsonValue
		public String toString() {
			return String.valueOf(value);
		}

		@JsonCreator
		public static LobEnum fromValue(String text) {
			for (LobEnum b : LobEnum.values()) {
				if (String.valueOf(b.value).equals(text)) {
					return b;
				}
			}
			return null;
		}
	}

	@NotNull
	private LobEnum lob;
	
	@NotNull
	@Size(max = 3)
	private String sysCode;
	
	@NotNull
	@Size(max = 20)
	private String contractNum;
	
	@Size(max = 10)
	private String subGroupNum;
	
	@Size(max = 10)
	private String certificateNum;

	@NotNull
	@Digits(fraction=4, integer = 7)
	private BigDecimal agentSplitPct;

	@NotNull
	@Size(min=6,max = 6)
	private String agentCode;

	@NotNull
	@Size(max = 20)
	private String basicPlanCode;

	@Size(max = 2)
	private String basicPlanVersNum;

	@NotNull
	@Size(max = 20)
	private String coveragePlanCode;

	@Size(max = 2)
	private String coveragePlanVersNum;

	@NotNull
	@Size(max = 1)
	private String isBasicPlan;

	@NotNull
	@Digits(fraction=0, integer = 11)
	private BigDecimal submitPc;

	@NotNull
	@Digits(integer = 3,fraction=2)
	private BigDecimal submitCaseCount;
	@Size(max = 30)
	private String appInKey;
	@Size(max = 30)
	private String salesSource;

	@Size(max = 101)
	private String proposalOwnerName;

	@Size(max = 101)
	private String proposalInsuredName;

	@Size(max = 250)
	private String basicPlanNameEng;

	@Size(max = 250)
	private String basicPlanNameChi;
	@Size(max = 250)

	private String coveragePlanNameEng;
	@Size(max = 250)

	private String coveragePlanNameChi;
	
	@NotNull
	@Digits(fraction=2, integer = 18)
	private BigDecimal submitApe;

	private String lastUpdateUser;

}
